package com.objcat.servicea.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.objcat.servicea.entity.po.RolePo;
import com.objcat.servicea.entity.po.RolePowerPo;
import com.objcat.servicea.mapper.RolePowerMapper;
import com.objcat.servicea.service.RolePowerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author misheep
 * @since 2020-07-27
 */
@Service
public class RolePowerServiceImpl extends ServiceImpl<RolePowerMapper, RolePowerPo> implements RolePowerService {

    @Autowired
    private RolePowerMapper rolePowerMapper;

    /**
     * 根据角色获得角色权限关系list
     * @param rolePo
     * @return
     */
    @Override
    public List<RolePowerPo> getRolePower(RolePo rolePo) {
        QueryWrapper<RolePowerPo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("role_id", rolePo.getRoleId());
        return rolePowerMapper.selectList(queryWrapper);
    }
}
